<template>
  <div class="page-container ver-layout-center">
    <h4>router传参示例页面</h4>
    <button @click="toQueryPage">query传参跳转</button>
    <button @click="toParamsPage">params传参跳转</button>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "index",
  methods: {
    toQueryPage() {
      //1.写法一
      // this.$router.push('/query?code=112')
      //2.写法二
      this.$router.push({path: '/transParams/query', query: {code: 123, name: '老李'}})
    },
    toParamsPage() {
      // this.$router.push({path: "/params", params: {code: 123, name: '老王'}})
      this.$router.push({name: 'params', params: {code: 321, name: '老王'}})
    }
  }
}
</script>

<style scoped>

</style>
